<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>仪器共享</title>
<meta name="keywords" content="科研仪器，生命科学仪器，环境检测仪器，实验常用设备，分析仪器">
<meta name="description" content="中国领先的科研仪器共享平台，让您快速找到各种类型的科学研究仪器。提升闲置仪器利用率，产生更大科研价值。涵盖：生命科学仪器、环境检测仪器、实验常用设备、分析仪器、仪表、物性测试、测量/计量仪器、在线及过程控制仪器。">
<!--<link rel="stylesheet" href="new_css/header_footer.css?t=1">-->
<link rel="stylesheet" href="new_css/userCenter.css">
<link rel="stylesheet" href="css/new_style.css">
<link rel="stylesheet" href="js" />
<script src="new_js/jquery-1.11.3.js"></script>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/common.css">
<style>
.myPage {
	margin: 0 auto;
	width: 990px;
	height: 80px;
	font-size: 12px;
	margin-top: 40px;
	margin-left: 431px;
}

.sun_title {
	text-align: center !important;
	width: 100%;
	height: 46px;
	line-height: 46px;
	margin: 0 auto;
	padding: 0px !important;
	border-left: 2px solid #fff;
	margin-top: 0px !important;
	cursor: pointer;
}

.sun_title:hover {
	background-color: #F4F4F4;
	border-left: 2px solid #FF8A00;
}

.activity {
	text-align: center !important;
	width: 100%;
	height: 46px;
	line-height: 46px;
	margin: 0 auto;
	padding: 0px !important;
	background-color: #F4F4F4;
	border-left: 2px solid #FF8A00;
}
</style>
<script>
	$(function() {

		$('#front_header .header_wrap .right').hover(function() {
			$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon2.png');
			$('#front_header .header_wrap .right .out').show();
		}, function() {
			$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon1.png');
			$('#front_header .header_wrap .right .out').hide();
		});

		//-----
		$("#item2").mouseover(function() {
			$(".item2_ul").css("display", "block");
		});


		$("#item2").mouseout(function() {
			$(".item2_ul").css("display", "none");
		});


		//----
		//				$('#item2').on('mouseover',function() {
		//					console.log("111111");
		//					$('#item2_ul').css('display','block');
		//				}
		//				$('#item2').on('mouseout',function() {
		//					$('#item2_ul').css('display', 'none');
		//				}

		$('#sorts').on('mouseover', 'li', function() {
			$(this).find('span img').attr('src', 'images/icon4.png');
		});
		$('#sorts').on('mouseout', 'li', function() {
			$(this).find('span img').attr('src', 'images/icon5.png');
		});

		$('.mainList .content .left li').click(function() {
			$(this).addClass('selected').siblings().removeClass('selected');
		});
	});
</script>

</head>

<body style="background:#fff;">
	<!--header-->
	<%@include file="/header2.jsp"%>

	<div class="mainList">
		<!--<div class="bNav">您的位置：首页><span>用户中心</span></div>-->
		<div class="content">
			<div class="left">
				<div class="title">仪器管理</div>
				<!--<div class="list_header">全部订单<img src="images/usercenter_icon.png" /></div>-->

				<div class="sun_title " id="xz1" onclick="list(1);">已评价</div>
				<div class="sun_title activity" id="xz2" onclick="list(2)">未评价</div>

				<!--<li class="selected">待确认</li>
						<li>确认</li>
						<li>待实验</li>
						<li>已完成</li>
						<li>未评价</li>
						<li>个人资料</li>-->

			</div>
			<div class="right">
				<div class="title">
					<span>服务实验订单</span>
				</div>
				<div class="tab_header">
					<div class="item1">服务名称</div>
					<div class="item2"></div>
					<div class="item3">服务收费</div>
					<div class="item4">仪器负责人</div>
					<div class="item5">交易状态</div>
					<div class="item6">交易操作</div>
				</div>
				<div class="infoList">
					<ul id="serviceList">
						<li>
							<div class="row1">
								<div>
									<span>2018-03-13 18:36:04 </span> <span>订单编号:
										3232430800330166</span>
								</div>
								<div>
									<img src="images/usercenter_icon2.png" />
								</div>
							</div>
							<div class="row2">
								<div class="tab1">
									<img src="images/usercenter_pic.png" />
								</div>
								<div class="tab2">高内涵筛选系统</div>
								<div class="tab3">operetta</div>
								<div class="tab4">张三</div>
								<div class="tab5">
									<p>已确认</p>
									<p>
										<a href="#this">查看详情</a>
									</p>
								</div>
								<div class="tab6">
									<div class="btn">
										<a href="bookingOrderDetail24.html">确认</a>
									</div>
								</div>
							</div>
						</li>
						<li>
							<div class="row1">
								<div>
									<span>2018-03-13 18:36:04 </span> <span>订单编号:
										3232430800330166</span>
								</div>
								<div>
									<img src="images/usercenter_icon2.png" />
								</div>
							</div>
							<div class="row2">
								<div class="tab1">
									<img src="images/usercenter_pic.png" />
								</div>
								<div class="tab2">高内涵筛选系统</div>
								<div class="tab3">operetta</div>
								<div class="tab4">张三</div>
								<div class="tab5">
									<p>待确认</p>
									<p>
										<a href="#this">查看详情</a>
									</p>
								</div>
								<div class="tab6">
									<div class="btn">
										<a href="bookingOrderDetail24.html">确认</a>
									</div>
								</div>
							</div>
						</li>
						<li>
							<div class="row1">
								<div>
									<span>2018-03-13 18:36:04 </span> <span>订单编号:
										3232430800330166</span>
								</div>
								<div>
									<img src="images/usercenter_icon2.png" />
								</div>
							</div>
							<div class="row2">
								<div class="tab1">
									<img src="images/usercenter_pic.png" />
								</div>
								<div class="tab2">高内涵筛选系统</div>
								<div class="tab3">operetta</div>
								<div class="tab4">张三</div>
								<div class="tab5">
									<p>已支付</p>
									<p>
										<a href="#this">查看详情</a>
									</p>
								</div>
								<div class="tab6">
									<div class="btn">
										<a href="bookingOrderDetail24.html">确认</a>
									</div>
								</div>
							</div>
						</li>
						<li>
							<div class="row1">
								<div>
									<span>2018-03-13 18:36:04 </span> <span>订单编号:
										3232430800330166</span>
								</div>
								<div>
									<img src="images/usercenter_icon2.png" />
								</div>
							</div>
							<div class="row2">
								<div class="tab1">
									<img src="images/usercenter_pic.png" />
								</div>
								<div class="tab2">高内涵筛选系统</div>
								<div class="tab3">operetta</div>
								<div class="tab4">张三</div>
								<div class="tab5">
									<p>待确认</p>
									<p>
										<a href="#this">查看详情</a>
									</p>
								</div>
								<div class="tab6">
									<div class="btn">
										<a href="bookingOrderDetail24.html">确认</a>
									</div>
								</div>
							</div>
						</li>
						<li>
							<div class="row1">
								<div>
									<span>2018-03-13 18:36:04 </span> <span>订单编号:
										3232430800330166</span>
								</div>
								<div>
									<img src="images/usercenter_icon2.png" />
								</div>
							</div>
							<div class="row2">
								<div class="tab1">
									<img src="images/usercenter_pic.png" />
								</div>
								<div class="tab2">高内涵筛选系统</div>
								<div class="tab3">operetta</div>
								<div class="tab4">张三</div>
								<div class="tab5">
									<p>待确认</p>
									<p>
										<a href="#this">查看详情</a>
									</p>
								</div>
								<div class="tab6">
									<div class="btn">
										<a href="#this">确认</a>
									</div>
								</div>
							</div>
						</li>
					</ul>
				</div>
				<!--page-->
				<div class="myPage clearfix">
					<!--currentpage="1" numbercount="100"-->
					<ul class="page" maxshowpageitem="5" pagelistcount="5" id="page"></ul>
				</div>
			</div>
		</div>

	</div>


	<!--footer-->
	
	<%@include file="/footer.jsp"%>

	<script src="js/jquery-1.11.3.js"></script>
	<script src="js/common.js"></script>

	
	<script>
		$(document).ready(function() {
		/*独家分页*/
			MyObjectogHHH = {
				//url : "http://localhost/app/exp/order",
				url : Server + "/app/exp/orderService",
				haveuid : $('#useridoflogin').val(),
				ishavesend : 2,
				boolean : false,
				type : "POST",
				dataType : "JSON",
				number : 1,
				AllCount : 0,
				nowp : 0,
				Callback : function(nowPage) {
					MyObjectogHHH.nowp = nowPage;
					list(MyObjectogHHH.nowp-1,MyObjectogHHH.ishavesend);
				}
			};
		
			function MyObjectogHHHofpageload() {
				$("#page").initPage((function() {
					$.ajax({
						"url" : MyObjectogHHH.url,
						"type" : MyObjectogHHH.type,
						"dataType" : MyObjectogHHH.dataType,
						"async" : MyObjectogHHH.boolean,
						"data" : {
							"offset" : MyObjectogHHH.number,
							"limit" : MyObjectogHHH.number,
							"uId" : MyObjectogHHH.haveuid,
							"state" : MyObjectogHHH.ishavesend
						},
						success : function(data) {
						
							MyObjectogHHH.AllCount = data.total;
						}
					});
					return MyObjectogHHH.AllCount;
				})(), MyObjectogHHH.number, MyObjectogHHH.Callback);
			}
			MyObjectogHHHofpageload();
			
			
			$("#xz1").click(function() {
				MyObjectogHHH.ishavesend = 1;
				MyObjectogHHHofpageload();
			})
			$("#xz2").click(function() {
				MyObjectogHHH.ishavesend = 2;
				MyObjectogHHHofpageload();
			})
		})


	
	/* $('#xz1').click(function(){
		list(1)
	})
	$('#xz2').click(function(){
		list(0)
	}) */
	
	function list(offset,state){
		var uId = $('#useridoflogin').val();
		//var uId = '4d272484d5844be693c05443c4edd71e';
		if(state == 1){//已评价
			$('#xz1').attr("class","sun_title activity");
			$('#xz2').attr("class","sun_title");
		}else if(state == 2){//未评价
			$('#xz1').attr("class","sun_title");
			$('#xz2').attr("class","sun_title activity");
		}
		$.ajax({
			url : Server + "/app/exp/orderService",
			//url : "http://localhost/app/exp/orderService",
			data:{
				"limit": 5,
				"offset": offset,
				"state":state,
				"uId":uId,
			},
			type:"POST",
			dataType:"json",
			success : function(data){
				var html = "";
				var m = data.rows;
				var pattren = '<li>\
						<div class="row1">\
							<div>\
								<span>#0</span> <span>订单编号:#1</span>\
							</div>\
							<div>\
								<img class="delIcon" src="images/usercenter_icon2.png" val='+state+' onclick="dele(#9,'+state+',#11);"/>\
							</div>\
						</div>\
						<div class="row2">\
							<div class="tab1">\
								<img src="#7" />\
							</div>\
							<div class="tab2"><a href="serviceDetail14_2?serviceId=#14">#2</a></div>\
							<div class="tab3">#3</div>\
							<div class="tab4">#4</div>\
							<div class="tab5">\
								<p>#5</p>\
								<p>\
									<a href="service_public24_2?orderId=#12&type=1">查看详情</a>\
								</p>\
							</div>\
							<div class="tab6">\
								<div class="btn" name="insBtn">\
									<a onclick="action(#8,#10,#13);">#6</a>\
								</div>\
							</div>\
						</div>\
					</li>';
				for(var i = 0; i < m.length ; i++){
					var param = m[i];
					var item = "";
					var state2 = "";
					var state1 = "";
					if(param.status == 0){
						state2 = "订单待确定";
						state1 = "确定";
					}else if(param.status == 1){
						state2 = "待支付";
						state1 = "";
					}else if(param.status == 2){
						state2 = "已支付";
						state1 = "开始实验";
					}else if(param.status == 3){
						state2 = "等待结果上传";
						state1 = "上传结果";
					}else if(param.status == 4){
						state2 = "等待确认";
						state1 = "";
					/* }else if(param.status == 5){
						state2 = "已完成";
						state1 = "评价"; */
					}else if(param.status == 5){
						if(param.rate == 0 || param.rate == 1){
							state2 = "未评价";
							state1 = "评价";							
						}else if(param.rate == 2 || param.rate == 3){
							state2 = "我已评价";
							state1 = "";	
						}
					}else if(param.status == 6){
						state2 = "已关闭";
						state1 = "";
					}
					var createTime = (param.createTime == null)?'':param.createTime;
					var number = (param.number == null)?'':param.number;
					var serviceName = (param.serviceName == null)?'':param.serviceName;
					var imagePath = (param.imagePath == null)?'':param.imagePath;
					var realname = (param.realname == null)?'':param.realname;
					var unit = (param.unit == null)?'元/天':param.unit;
					var fee = (param.serviceFee == null)?0:param.serviceFee;
					item += pattren
						.replace("#0", createTime)
						.replace("#1", number)
						.replace("#2", serviceName)
						.replace("#3", fee+unit)
						.replace("#4", realname)
						.replace("#5", state2)
						.replace("#6", state1)
						.replace("#7", imagePath)//图片路径
						.replace("#8", param.status)
						.replace("#9", param.id)
						.replace("#10", param.id)
						.replace("#11", param.status)
						.replace("#12", param.id)
						.replace("#13", param.rate)
						.replace("#14", param.inId),
					html += item;
				}
				$('#serviceList').html(html);
				$("div[name='insBtn']").each(function(){
					var btnContent=$(this).children().eq(0).text();
					if(btnContent==""){
						$(this).parent().empty();
					}else if(btnContent=="待支付"||btnContent=="待实验"||btnContent=="已评价"||btnContent=="已支付"){
						$(this).next().hide();
					}
				});
				$(".delIcon").each(function(){
					if($(this).attr("val")==2){
						$(this).hide();
					}
				});
			}
		});
	}
	
	function dele(id,state,state1){
		if(state1 != 6 && (state1 !=5&&state!=2 )){
			alert("当前订单不允许删除")
			return;
		}
		var msg = "您真的确定要删除吗？\n\n请确认！";
		if(confirm(msg)==true){
			del(id,state);
			return true;
		}else{
			return false;
		}
	}
	
	function del(id,state){
		$.ajax({
			url:Server + "/app/exp/orderDelete",
			data:{
				"orderId":id,
			},
			success : function(data){
				if(data == 1){
					alert("删除成功！")
					//list(state)
					window.location.reload();
				}else if(data == 0){
					alert("删除失败！")
				}
			},
			error :function(msg){
				alert("删除失败！")
			}
		});
	}
	
	</script>
	<script>

		
		
		function action(state,id,rate){//操作跳转
			if(state == 0 ){
				$(location).attr("href","service_public24_2?orderId="+id+"&type=3");
			}else if(state == 5 && (rate == 0 || rate == 1)){
				$(location).attr("href","lab_order_details26?orderId="+id+"");
			}else if(state == 2){
				$(location).attr("href","service_public24_2?orderId="+id+"&type=3&status=2");
			}else if(state == 3){
				$(location).attr("href","uploadResults?oid="+id+"");
			}
		}
	</script>


	<style>
	.mainList .content .right {
		width: 950px;
		float: right;
		height: 100%;
		position: relative;
		min-height: 1000px;
		padding: 0 20px;
		border: 1px solid #d3d3d3;
	}
	.myPage {
		margin: 0 auto;
		width: 600px;
		height: 80px;
		font-size: 12px;
		position: absolute;
		bottom: 0px;
		left: 400px;
	}
	</style>

	<style>
		.tab1 img {
		    width: 100px;
		    vertical-align: middle;
		    height: 100px;
		}
	</style>

</body>

</html>